package IO;

import java.io.FileReader;
import java.io.IOException;
import java.io.Reader;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: hp
 * Date: 2024-08-27
 * Time: 14:21
 */
public class Demo7 {
    public static void main(String[] args) {
        try(Reader reader = new FileReader("./text.txt")) {
            char[] buffer = new char[1024];
            int n = reader.read(buffer);
            for(int i = 0; i < n; i++) {
                System.out.print(buffer[i]);
            }
            /*while(true) {
                int n = reader.read();
                if(n == -1) {
                    break;
                }
                char ch = (char) n;
                System.out.print(ch);
            }*/
        }catch (IOException e) {
            e.printStackTrace();
        }
    }
}
